<template>
    <van-nav-bar title="搜索" left-text="返回" left-arrow @click-left="onClickLeft" />
    <form action="/">
        <van-search v-model="value" show-action placeholder="请输入搜索关键词" @search="onSearch" />
    </form>
    <div>热门搜索</div>
    <div v-for="item in list" class="list">
        {{ item.keyword }}
    </div>
</template>

<script setup lang="ts">
import { hotword } from '../api/pro'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const value = ref('')
const list = ref()
const onClickLeft = () => history.back();
hotword().then(res => {
    console.log(res)
    list.value = res.data
})
const onSearch = (value) => {
    router.push(`/list/${value}`)
}

</script>

<style>
.list {
    margin-left: 10px;
    margin-bottom: 10px;
}
</style>